import { Routes, Route, Navigate } from 'react-router-dom'

import CustomRouter from './components/CustomRouter'
import { customHistory } from './utils/history'

import './App.scss'

import Login from '@/pages/Login'
import Layout from '@/pages/Layout'
import Home from './pages/Home'
import Profile from './pages/Profile'
import Question from './pages/Question'
import Video from './pages/Video'
import ProfileEdit from  './pages/Profile/Edit'

function App() {
  return (
    <CustomRouter history={customHistory}>
      <div className="app">
        <Routes>
          <Route path="/" element={<Navigate to="/home" />} />
          <Route path="/login" element={<Login />} />
          <Route path="/home" element={<Layout />}>
            {/* index代表该路由的字节点 就是路由的子路由*/}
            <Route index element={<Home />} />
            <Route path="question" element={<Question />}/>
            <Route path="profile" element={<Profile />}/>
            <Route path="video" element={<Video/>} />
          </Route>
          <Route path="Profile/edit" element={<ProfileEdit />}/>
        </Routes>
      </div>
    </CustomRouter>
  )
}

export default App
